import {Request} from './request'
import global from '@/common/global'
const host = global['PATH']['prodHost']

const https = new Request({
  baseURL: host.netPath
})

export const getTermlist= (query:any)=> {
  return https.post('/service-base-platform/rest/syscode/termlist', query)
}

export const getFunList= (query:any)=> {
  return https.post('/service-base-platform/rest/syscode/funlist', query)
}

/**
	 * 获取院内hosPatientId
	 * 
	 */
export const getHosPatientId= (query:any)=> {
  return https.post('/service-hos-interface/rest/patient-list/get-patient-id', query)
}


/**
	 * 第三方查询用户信息
   * accountId	string 微信openid-支付宝userid
   * accountType	string 第三方授权平台类型代码(1-微信公众号，11-微信小程序，2-支付宝生活号，22-支付宝小程序 3-银联账号，4-中行账号)
   * cellPhoneNum	string
   * sysCode	系统码
	 * 
	 */
export const getToken= (query:any)=> {
  return https.post('/service-pat-order/rest/hr-auth/get-login-token', query)
}

/**
	 * 第三方自动注册用户信息
	 * 
	 */
export const register= (query:any)=> {
  return https.post('/service-pat-order/rest/hr-auth/third-user-create', query)
}

/**
	 * token查用户信息
	 * 
	 */
export const getUserInfoByToken= (query:any)=> {
  return https.post('/service-pat-order/rest/hr-auth/user-info-by-token', query)
}


/**
	 * 查询患者挂号列表
	 * 
	 */
export const getVisitList= (query:any)=> {
  return https.post('/service-pat-order/rest/out-regist/patient-id', query)
}

/**
	 * 查询患者挂号详情
	 * 
	 */
export const getVisitDetail= (query:any)=> {
  return https.post('/service-pat-order/rest/out-regist/register-id', query)
}


/**
	 * 取消订单
	 * 
	 */
export const cancelRegister= (query:any)=> {
  return https.post('/service-pat-order/rest/out-regist/cancel', query)
}




/**
	 * 查询患者历史慢病就诊信息
	 * 
	 */
export const getChronicHis= (query:any)=> {
  return https.post('/service-pat-order/rest/out-regist/checkPatientHistoryChronic', query)
}

/**
	 * 查询患者历史慢病就诊信息
	 * 
	 */
export const getRecordList= (query:any)=> {
  return https.post('/service-hos-interface/rest/hos-medical-record/query-medical-record-list', query)
}

// 挂号
export const saveNoDocRegister= (query:any)=> {
  return https.post('/service-pat-order/rest/out-regist/no-doc-register', query)
}




// export const getNoticeList= (query:any)=> {
//   return https.post('/homa-service-interface/rest/HomaInterface/HRD220008', query)
// }


// export const getNoticeList1 = async (query: any) => {
//   const res = await https.post('/homa-service-interface/rest/HomaInterface/HRD220008', query);
//   return res?.data;
// };


export const getWatchQueryList = async (query: any) => {
  return await https.post('/homa-service-interface/rest/HomaInterface/HRD200051', query);
};

/**
  * 发送短信验证码
  * 
*/
export const sendCode = (query:any)=> {
  return https.post('/service-pat-order/rest/hr-auth/send-code-msg', query)
}

/**
  * 校验验证码
  * 
*/
export const checkCode = (query:any)=> {
  return https.post('/service-pat-order/rest/hr-auth/check-code', query)
}


const cardRequest = new Request({
  baseURL: host.cardPath
})

/**
	 * 读卡
	 * 
	 */
export const readCard = async (query: any) => {
  return await cardRequest.post('/heren.com/payment/jiaXingSEPaymentHandler/readCrad', query);
};

/**
	 * 退卡
	 * 
	 */
export const refundCard = async (query: any) => {
  return await cardRequest.get('/heren.com/payment/jiaXingSEPaymentHandler/refundCard', query);
};

/**
	 * 打印
	 * 
	 */
export const printReceipt = async (query: any) => {
  return await cardRequest.post('/heren.com/payment/jiaXingSEPaymentHandler/printReceipt', query);
};

const hisRequest = new Request({
  baseURL: host.hisPath
  // headers: {
  //   "Content-Type": "application/xml"
  // }
},'hisRequest'
)

/**
	 * 查询患者档案信息
   * 建档患者可能没有手机号码
	 * 
	 */
export const queryArchives = async (query: any) => {
  let data = {
    Fid:'F152',
    query
  }
  return await hisRequest.post('/hi-doctor/HRD102005', data);
};


/**
	 * 建档
	 * 
	 */
export const buildArchives = async (query: any) => {
  let data = {
    Fid:'F142',
    query
  }
  return await hisRequest.post('/hi-doctor/HRD102005', data);
};

/**
	 * 查询代缴费记录
	 * 
	 */
export const paymentList = async (query: any) => {
  let data = {
    Fid:'F206',
    query
  }
  return await hisRequest.post('/hi-doctor/HRD102005', data);
};


/**
	 * 查询代缴费详情
	 * 
	 */
export const paymentDetail = async (query: any) => {
  let data = {
    Fid:'F209',
    query
  }
  return await hisRequest.post('/hi-doctor/HRD102005', data);
};

/**
	 * 门诊预结算
	 * 
	 */
export const preSettlement = async (query: any) => {
  let data = {
    Fid:'F204',
    query
  }
  return await hisRequest.post('/hi-doctor/HRD102005', data);
};


/**
	 * 5.3.4.门诊结算F202
	 * 
	 */
export const settlement = async (query: any) => {
  let data = {
    Fid:'F202',
    query
  }
  return await hisRequest.post('/hi-doctor/HRD102005', data);
};


// his第二套服务
const hisNewRequest = new Request({
  baseURL:host.hisPathNew
},'hisRequestNew'
)

/**
	 * 根据就诊流水号查询接诊信息
	 * 
	 */
export const getOutpVisitRec= (query:any)=> {
  return hisNewRequest.post('/heren/api/clinic-openplatform/findOutpVisitRec', query)
}


/**
	 * 根据就诊流水号查询缴费凭条信息
	 * 
	 */
export const getOutpBillTicketape= (query:any)=> {
  return hisNewRequest.post('/heren/api/bill/open/detail/getOutpBillTicketape', query)
}


const thirdRequest=new Request({
  baseURL: "https://echarts.apache.org/examples"
})
export const getMap = async (query: any) => {
  return await thirdRequest.get('/data/asset/data/hangzhou-tracks.json', query);
};



